<?php
namespace app\index\controller;
// namespace app\zw_admin\controller;
use \think\Controller;
use think\Db;
// use think\Controller;
use think\Session;
use think\Request;
use Endroid\QrCode\Tests;
use qrcode;
class IndexController extends Controller
{
    public function index()
    {

    	$phone = Session::get('member_phone');
    	$seller_id = Session::get('seller_name');
    	// dump($seller_id);
    	$this->assign('phone',$phone);
    	$this->assign('seller_id',$seller_id);
       	return $this->fetch('index');
    }



    public function generate()
    {

    	$phone = Session::get('member_phone');
    	$seller_id = Session::get('seller_name');
    	$sid = Session::get('seller_id');
    	$seller_list = Db::name('seller')
        ->alias('b')
        ->join('drm_merchant w','b.merchant_name = w.m_id')
        ->where(['seller'=>$sid])
        ->select();
        $m_name = $seller_list[0]['m_name'];
    	// $seller_list = Db::name('seller')->where(['seller'=>$sid])->find();
    	// $seller_n
    	// dump($seller_list);
    	// exit;
    	$this->assign('phone',$phone);
    	$this->assign('seller_id',$seller_id);
    	$this->assign('m_name',$m_name);
    	return $this->fetch();
    }










    public function er_code()
    {
    	include_once ROOT_PATH.'extend/phpqrcode/qrlib.php';
    	QRcode::png('https://www.baidu.com',false,'OR_ECLEVEL_L',10);
    	exit;
        
    }
}
